<?php if(!empty($subvo)){
    $v = $subvo;
    $subvo = '';
}
if(!empty($subsubvo)){
    $v = $subsubvo; 
    $subsubvo = '';
}
?>

<?php if($attrList){?>
<script>
	function attrSubmit(id){
		var isAdd=true;
		$("#attrForm input[type='hidden']").each(function(index, element) {
            if($(this).val()==id){
				$(this).remove();
				isAdd=false;
			}
			if($(this).val().split('_')[0]==id.split('_')[0]){
				$(this).remove();
			}
        });
		if(isAdd){
			$('<input type="hidden" name="attrval[]" value="'+id+'">').appendTo("#attrForm");
		}
		//生成条件
		var map=new Array();
		$("#attrForm input[type='hidden']").each(function(index, element) {
            map.push($(this).val());
        });
		$("#attrFormRe input[name='attrvalRe']").val(map.join(';'));
		if($("#attrFormRe input[name='attrvalRe']").val()==''){
			$("#attrFormRe input[name='attrvalRe']").val('notattr');
		}
		
		// alert($("#attrFormRe input[name='attrvalRe']").val());
		document.getElementById("attrFormRe").submit(); return;
		//$("#attrFormRe").submit();
	}
	
	   
	
	
</script>

<form action="<?php U('Product/index');?>" id="attrFormRe" method="get">
<input type="hidden" name="id" value="<?php echo $cid;?>">
<input type="hidden" name="p" value="0">
<input type="hidden" name="attrvalRe" value="">
</form>
<div id="attrForm">

<?php foreach($curattrval as $key => $voattr){?>
	<input type="hidden" name="attrval[]" value="<?php echo $voattr;?>">
<?php }?>
</div>

<div style="margin:0 auto; margin-bottom:10px;">
<ul id="sedAttr">


<?php foreach($attrList as $key => $voattr){?>

	<li <?php if($key%2==1){?>style="background:#f7f1f1"<?php }?>><span><?php echo $voattr['title'];?>：</span>
    	<ul>
            
            <?php foreach($voattr['list'] as $key => $lvoattr){?>
        	<li><a <?php if(in_array($voattr['id'].'_'.$lvoattr['id'],$curattrval)){?>class="cur"<?php }?> href="#" onClick="attrSubmit('<?php echo $voattr['id'];?>_<?php echo $lvoattr['id'];?>');"><?php echo $lvoattr['val'];?></a></li>
            <?php }?>
            
        </ul><div style="clear"></div>
    </li>
<?php }?>
</ul></div>





<?php } ?>









<div class="viewBox myBox<?php echo $v['id'];?>" <?php if($_SESSION[C('USER_AUTH_KEY')]){?> sortID="<?php echo $v['sort'];?>" modulesID="<?php echo $v['id'];?>" title="<?php echo $v['title'];?>" deleteUrl="<?php echo U('/Admin/Modules/delete',array('id'=>$v['id']));?>" settingUrl="<?php echo U('/Admin/Modules/edit',array('id'=>$v['id']));?>" isEdit="0"<?php }?>>
  <?php if(!empty($v['dataname'])){
                $v['content'] = $v['dataname'];
                
        }else{
            $v['content'] = unserialize($v['content']);
        }
         ?>
  <div class="panel panel-primary">
    <?php include(TMPL_PATH.'Home/TemplateDefault/Public-Moduletitle'.C('TMPL_TEMPLATE_SUFFIX')); ?>
    <div class="panel-body">
    
      <?php foreach($v['content'] as $key => $p):?>
      <div class="col-md-3 col-xs-6 col-sm-4 list<?php echo $key+1;?>">
        <div <?php if($_SESSION[C('USER_AUTH_KEY')]){?>modulesID="<?php echo $v['id'];?>"<?php }?> class="thumbnail viewBoxCss"><a hrefrel="<?php echo getArtLink($p['id'], $p['module']);?>" <?php if(getArtLink($p['id'], $p['module']) == ''){?>rel="lightbox-demo"<?php }?> href="<?php if(getArtLink($p['id'], $p['module']) == ''){?><?php echo getThumbPath($p['img_url']);?><?php }else{ ?><?php echo getArtLink($p['id'], $p['module']);?><?php }?>"><img alt="<?php echo $p['title'];?>" src="<?php echo getThumbPath($p['img_url'],$v['thumbtype']);?>" width="100%" /></a>
          <div <?php if($_SESSION[C('USER_AUTH_KEY')]){?>modulesID="<?php echo $v['id'];?>"<?php }?> class="caption viewBoxCss" style="position:relative;">
            <h3> <a class="viewBoxCss Atitle" <?php if($_SESSION[C('USER_AUTH_KEY')]){?>modulesID="<?php echo $v['id'];?>"<?php }?> href="<?php echo getArtLink($p['id'], $p['module']);?>"><?php echo cut_str($p['title'],$v['listTitleLength'],0);?></a> </h3>
            
            
            
            <?php if($v['listContentLength'] > 0){?>
            <p> <?php echo cut_content($p,$v['listContentLength'], 0, $v['listContentOut']); ?> </p>
            <?php }?>
            
            
            
            
            
            
            
            <span class="datetime"><?php echo date('Y-m-d', $p['datetime']);?></span> 
            
            
            
            <a style="position:absolute; right:5px; bottom:2px; color:#CC3636; font-size:1.5em;" class="addCartList" onClick="addCartList(<?php echo $p['id'];?>);"><i class="fa fa-cart-plus"></i></a>
            
            
            </div>
        </div>
      </div>
      <?php endforeach; ?>
      <div class="clearfix"></div>
      
      
      <?php if($v['display_pages']>0){echo $pages;}?>
      
     
    </div>
  </div>
</div>
